﻿<%@ Page   Language="C#" AutoEventWireup="true" CodeBehind="ShopLogon.aspx.cs" Inherits="RabbitManage.UI.ShopLogon" %>

<html>
    <head runat="server">
        <meta charset="utf-8" />
        <title><%: Page.Title %> - My ASP.NET Application</title>
        <asp:PlaceHolder ID="PlaceHolder1" runat="server">     
              <%: Scripts.Render("~/bundles/modernizr") %>
        </asp:PlaceHolder>  
        <webopt:BundleReference ID="BundleReference1" runat="server" Path="~/Content/css" /> 
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width" />
    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">
                        <a id="A1" runat="server" href="~/">商家后台</a>
                    </p>
                </div>
                <div class="float-right">
                    <section id="login">
                        <%if (string.IsNullOrEmpty(ShopName))
                          {%>
                        <a href="/UI/ShopRegister.aspx" >注册</a>
                        <a href="/UI/ShopLogon.aspx" >登入</a>
                          <%}
                          else
                          {%>
                        <a href="/UI/ShopDetail.aspx" ><%=ShopName %></a>
                        <a href="/Action/ShopLogOff.aspx" onclick="return confirm('确认登出？')">登出</a>
  
                          <%} %>
                    </section>
                    <nav>
                        <ul id="menu">
                            <li><a id="A2" runat="server" href="~/">Home</a></li>
                            <li><a id="A3" runat="server" href="~/About.aspx">About</a></li>
                            <li><a id="A4" runat="server" href="~/Contact.aspx">Contact</a></li>
                            <li><a id="A5" runat="server" href="~/UI/ProductList.aspx">Product List</a></li>
                            <li><a id="A6" runat="server" href="~/UI/ProductAdd.aspx">Product Add</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
        </header>
        
        <div id="body">
            <section class="content-wrapper main-content clear-fix">
                <table>
                    <tr>
                        <td style="width: 200px; vertical-align: top;">
                            
                        </td>
                        <td style="width: 800px;">
                            
                            <form id="form1" action="../Action/ShopLogon.aspx" method="POST">
                                
                                <hgroup class="title">
                                    <h2>商家登陆</h2>
                                </hgroup>
    
                                <script type="text/javascript">
                                    form1.onsubmit = function (e) {
                                        e.preventDefault();

                                        var data = {};
                                        for (var i = 0, ii = form1.length; i < ii; ++i) {
                                            var input = form1[i];
                                            if (input.name) {
                                                data[input.name] = input.value;
                                            }
                                        }

                                        var xhr = new XMLHttpRequest();
                                        xhr.open(form1.method, form1.action, true);
                                        xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');

                                        xhr.send(JSON.stringify(data));

                                        xhr.onloadend = function () {
                                            if (xhr.responseText == "true") {
                                                window.location = "ShopDetail.aspx";
                                            } else {
                                                alert(xhr.responseText);
                                            }
                                        };
                                    };
                                </script>

                                <table>
                                    <tr>
                                        <td>用户名:</td>
                                        <td>
                                            <input type="text" id="inputName" name="Name"/>
                                        </td>
                                    </tr>
        
                                    <tr>
                                        <td>密码:</td>
                                        <td>
                                            <input type="password" id="inputPassword" name="Password"/>
                                        </td>
                                    </tr>

                                </table>
    
                                <input type="submit" value="登陆" />

                            </form>
                            
                        </td>
                    </tr>
                </table>
            </section>
        </div>
        <footer>
            <div class="content-wrapper">
                <div class="float-left">
                    <p>&copy; nalandra</p>
                </div>
            </div>
        </footer>
        

        
    </body>
    
</html>